<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>上传资源</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/uploadify.css">
</head>
<body>
	<input type="file" name="file" id="upload_file"/>
	<img id="img" width="154" height="154" alt="上传的图片" src="images/card_face_default.png"  class='img-polaroid'/>	
	
	<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
	<script type="text/javascript" src="js/jquery.uploadify.min.js"></script>
	<script type="text/javascript">
		var url = '';
		function getUrl() {
			$.ajax({
				type:'GET',
				url: '/uploadurl.do?redirect=0',
				async: false,
				success: function(data) {
					url = data;
				},
			});
		}
		$(function(){
			getUrl();
			$('#upload_file').uploadify({
				'swf': 'js/uploadify.swf',
				'uploader': url,
				'multi':true,
				'method':'post',
				'formData': {'t':'t'},
				'fileSizeLimit': '10MB',
				'fileTypeExts': "*.gif,*;*.jpg;*.png",
				'cancelImg': 'images/uploadify-cancel.png',
				'buttonText': '上传图片',
				'onUploadSuccess' : function(file, data, response){
					$('#img').attr("src", data);
					getUrl();
					$('#upload_file').uploadify('settings','uploader',url);
				}
			});
		});
	</script>
	
</body>
</html>